package cn.car91.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageButton;
import android.widget.Toast;
import cn.car91.R;

import com.lidroid.xutils.view.annotation.ViewInject;

public class BoxMainActivity extends BaseFragment implements  android.view.View.OnClickListener {

    @ViewInject(R.id.encyclopediabtn)
	ImageButton encyclopediabtn;// 百科
    @ViewInject(R.id.exposurebtn)
	ImageButton exposurebtn;// 曝光
    @ViewInject(R.id.expectbtn)
	ImageButton consultbtn;// 咨询
    @ViewInject(R.id.oilbtn)
	ImageButton oilbtn;// 油价
	Intent intent = new Intent();

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        // TODO Auto-generated method stub
	    return inflater.inflate(R.layout.activity_box_main, container,
                false);
	}

    @Override
    public void onViewCreated(View view, Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);

        into();
    }
	
	private void into() {
		// TODO Auto-generated method stub
		encyclopediabtn.setOnClickListener(this);
		exposurebtn.setOnClickListener(this);
		consultbtn.setOnClickListener(this);
		oilbtn.setOnClickListener(this);
	}
	
	@Override
	public void onClick(View view) {
		// TODO Auto-generated method stub
		if (view == encyclopediabtn) {
			intent.setClass(getActivity(), ArticleMainActivity.class);
			startActivity(intent);
		} else if (view == exposurebtn) {
			intent.setClass(getActivity(), ExposureMainActivity.class);
			startActivity(intent);
		}/* else if (view == consultbtn) {
			intent.setClass(getActivity(), ArticleMainActivity.class);
			startActivity(intent);
		}*/ else if (view == oilbtn) {
			intent.setClass(getActivity(), OilActivity.class);
			startActivity(intent);
		} else {
			Toast.makeText(getActivity(), "程序猿正在努力中",
					Toast.LENGTH_SHORT).show();
		}
	}


}
